package com.qianli.cashmama.trade.common.enums;

/**
 * Created with IntelliJ IDEA.
 * User: sm
 * Date: 2017/7/21
 * Time: 上午11:28
 *
 * @author
 */
public enum TradeStatusEnum {
    /**/
    INIT(0, "INIT"),                                    // 初始化
    CREATE_SUCCESS(1, "CREATE SUCCESS"),                // 创建成功
    AUDIT_WATTING(2, "AUDIT WATTING"),                  // 等待信审回执
    LOAN_WAITTING(3, "LOAN WAITTING"),                  // 待放款回执
    PAY_RETRY(4, "PAY RETRY"),                          // 放款失败
    REPAYMENT_WATTING(5, "REPAYMENT WATTING"),          // 待还款
    OVERDUE(6, "OVERDUE"),                              // 逾期中
    NORMAL_REPAYMENT(7, "NORMAL_REPAYMENT"),            // 正常还款
    EARLY_REPAYMENT(8, "EARLY_REPAYMENT"),              // 提前还款
    OVERDUE_REPAYMENT(9, "OVERDUE_REPAYMENT"),          // 逾期还款
    AUDIT_REJECT(10, "AUDIT_REJECT"),                   // 拒绝
    PENDING_WITHDRAWAL(11, "PENDING WITHDRAWAL"),       // 待提现
    MANUAL_CLOSED(12, "CLOSED");                        // 放款失败关闭
    ;

    private int status;
    private String desc;

    TradeStatusEnum(int status, String desc) {
        this.status = status;
        this.desc = desc;
    }

    public int getStatus() {
        return status;
    }

    public TradeStatusEnum setStatus(int status) {
        this.status = status;
        return this;
    }

    public String getDesc() {
        return desc;
    }

    public TradeStatusEnum setDesc(String desc) {
        this.desc = desc;
        return this;
    }

    public static TradeStatusEnum convertByStatus(int status) {
        TradeStatusEnum tradeStatusEnum = null;
        for (TradeStatusEnum statusEnum : TradeStatusEnum.values()) {
            if (statusEnum.getStatus() == status) {
                tradeStatusEnum = statusEnum;
            }
        }

        return tradeStatusEnum;
    }
}
